package com.zhanqiao.service;

import com.zhanqiao.Dao.SelectReturnProductDao;
import com.zhanqiao.domain.ArticleBean;
import com.zhanqiao.domain.ProductBean;
import sun.misc.PerfCounter;

import java.sql.SQLException;
import java.util.List;

public class SelectReturnProductService implements ArticleService {
    SelectReturnProductDao selectReturnProductDao = new SelectReturnProductDao();
    @Override
    public List<ArticleBean> articleService() {
        return null;
    }

    public List<ProductBean> articleService(String page, String limit) {

        List<ProductBean> list = selectReturnProductDao.selectAll(page, limit);
        return list;
    }
    public Long getProductCount() throws SQLException {
        return selectReturnProductDao.findCount();
    }

    public int buyProduct(int id) throws SQLException {
        return selectReturnProductDao.deleteProduct(id);
    }

    public int buyAndSale(Integer pid, String pname, Integer psaleprice, Integer pcount) throws SQLException {
        return selectReturnProductDao.updateProduct(pid, pname, psaleprice, pcount);
    }
}
